home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pru_randomambient.cog < prev    next >
Text File  |  1999-11-15  |  2KB  |  97 lines

  1.  
  2. # Jones 3D Cog Script
  3. #
  4. # PRU_RandomAmbient.cog
  5. #
  6. # [SXC] [TL] on bass... [GGJ]
  7. #
  8. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  9. #
  10. # =======================================================================================
  11. symbols
  12.  
  13. message    timer
  14. message    entered
  15.  
  16. sector    soundOnSector0        linkid=1
  17. sector    soundOnSector1        linkid=1
  18. sector    soundOnSector2        linkid=1
  19.  
  20. sector    soundOffSector0        linkid=2
  21. sector    soundOffSector1        linkid=2
  22. sector    soundOffSector2        linkid=2
  23.  
  24. sound    wav0=gen_cave_a6.wav        local
  25. sound    wav1=shw_amb7.wav            local
  26. sound    wav2=shw_amb3.wav            local
  27. sound    wav3=gen_amb_eerie_01.wav    local
  28. sound    wav4=gen_amb_eerie_06.wav    local
  29. sound    wav5=gen_amb_eerie_10.wav    local
  30. sound    wav6=gen_cave_a1.wav        local
  31.  
  32.  
  33. flex    min_interval=1            local
  34. flex    range_interval=5        local
  35.  
  36. int        pruSound=0                local
  37. int        b_IsPlaying=0            local
  38. int        TIMERID_AMB=1            local
  39.  
  40. end
  41.  
  42. # ========================================================================================
  43. code
  44.  
  45. # ........................................................................................
  46. timer:
  47.  
  48.     # Dont play sound if already doing so, but try again later
  49.     if ( b_IsPlaying == 1 )
  50.     {
  51.         SetTimerEx(min_interval+(rand()*range_interval), TIMERID_AMB, 0, 0);
  52.         return;
  53.     }
  54.  
  55.     pruSound = playsoundlocal(wav0[RandBetween(0, 6)], 1, (RandBetween(-1, 1)), 0, 0);
  56.  
  57.     if (pruSound != -1)
  58.     {
  59.         b_IsPlaying = 1;
  60.  
  61.         ChangeSoundPitch(pruSound, (Rand() + 0.25), 0.01);
  62.         WaitForSound(pruSound);
  63.  
  64.         b_IsPlaying = 0;
  65.     }
  66.  
  67.     SetTimerEx(min_interval+(rand()*range_interval), TIMERID_AMB, 0, 0);
  68.  
  69.     return;
  70.  
  71.  
  72. # ........................................................................................
  73. entered:
  74.  
  75.     if (GetSenderID() == 1)
  76.     {
  77.         SetTimerEx(min_interval+(rand()*range_interval), TIMERID_AMB, 0, 0);
  78.         return;
  79.     }
  80.  
  81.     if (GetSenderID() == 2)
  82.     {
  83.         KillTimerEx(TIMERID_AMB);
  84.  
  85.         if ( b_IsPlaying == 1 )
  86.         {
  87.             Reset();
  88.             b_IsPlaying = 0;
  89.             StopSound(pruSound, 0.9);
  90.         }
  91.     }
  92.  
  93.     return;
  94.  
  95. # ........................................................................................
  96. end
  97.